<%@page contentType="text/html; charset=utf-8"%>
<script type="text/javascript">
	var $userObj = {}, $tg_user , $user_window ;
	$(function() {
		$userObj = {
			init: function() {
				$tg_user = $('#tg_user').treegrid({
					title: '用户管理',
					url: '/user/list', method: 'GET', idField: 'id', treeField: 'name',
					fit: true, border: false, rownumbers: true, rownumberWidth: 40, toolbar: "#toolbars_user",
					frozenColumns: [[
						{title: 'ID', field: 'id', hidden: true},
						{title: '用户名称', field: 'realName', width: 100},
						{title: '登录账号', field: 'username', width: 100}
					]],
					columns: [[
						{title: '性别', field: 'gender', width: 60, align: 'center'},
						{title: '电子邮箱', field: 'email', width: 200},
						{title: '手机号码', field: 'mobile', width: 110},
						{title: '账户类型', field: 'type', width: 60},
						{title: '最后登录时间', field: 'last_login_time', width: 80},
						{title: '最后登录IP', field: 'last_login_ip', width: 100},
						{title: '是否修改过密码', field: 'is_change_pwd', width: 100},
						{title: '连续输错密码次数', field: 'pwd_error_count', width: 120},
						{title: '最后输错密码时间', field: 'pwd_error_time', width: 120},
						{title: '备注信息', field: 'remarks', width: 400},
						{title: '创建时间', field: 'create_time', width: 120},
						{title: '创建者', field: 'create_by', width: 70},
						{title: '最后更新时间', field: 'update_time', width: 120},
						{title: '更新者', field: 'update_by', width: 70},
					]]
				});
			},
			add: function() {
				$user_window = MM.addWindow({title: '添加用户', href: '/user/form', width: 600, height: 320});
			},
			del: function() {
				var row = $tg_user.treegrid('getSelected') ;
				alert("del=="+row.id);
			},
			update: function() {
				var row = $tg_user.treegrid('getSelected') ;
				alert("update=="+row.id);
			},
			reload: function() {
				$tg_user.treegrid('reload');
			}
		};
		
		$userObj.init() ;
	});
</script>

<div id="tg_user">
	<div id="toolbars_user"> 
		<a onclick="$userObj.add();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-add'">添加</a> 
		<a onclick="$userObj.update();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-edit'">编辑</a> 
		<a onclick="$userObj.del();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-cancel'">删除</a> 
		<a onclick="$userObj.reload();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-reload'">刷新</a> 
	</div>
</div>
